package com.huatai.verity.controller;

import com.huatai.common.api.R;
import com.huatai.verity.utils.AESUtils;
import com.huatai.verity.utils.KeyGeneratorUtil;
import com.huatai.verity.utils.RSAUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @program: ht-system
 * @description: 签名颁发
 * @author: songxiude
 * @create: 2023-07-20 14:20
 **/
@RestController
@RequestMapping("/sign")
public class KeyGeneratorController {

	@PostMapping("/getPubPriInfo")
	public R<Map<String,String>> getPubPriInfo(){
		Map<String, String> generater = KeyGeneratorUtil.generater();
		return R.data(generater);
	}

	/**
	 * 获取AES
	 * @return
	 * @throws Exception
	 */
	@PostMapping("/getAes")
	public R getAes() throws Exception {
		return R.data(RSAUtils.encrypt("waytale"));
	}

	@PostMapping("/getSystemSign")
	public R getSystemSign(){
		String encrypt = AESUtils.encrypt("waytale2023");
		return R.data(encrypt);
	}

//	@PostMapping("/getSignFile")
//	public void getSignFile(){
//		//系统识别码
//		String systemSign = LicenseManager.getSystemSign();
//		AESUtils.createLicense(systemSign,"2023-07-19 10:00:00","2023-08-19 10:00:00","2023-07-19 10:00:00","1.0","D:\\test.xml");
//	}
}

